<#if packageStyle == "service">
package ${sourceBasePackage}.${entityPackage}.service.impl;
import ${sourceBasePackage}.${entityPackage}.service.${className}Service;
import ${sourceBasePackage}.${entityPackage}.mapper.${className}Mapper;
import ${sourceBasePackage}.${entityPackage}.entity.${className};
<#elseif packageStyle == "project">
package ${sourceBasePackage}.service.impl.${entityPackage};
import ${sourceBasePackage}.service.${entityPackage}.${className}Service;
import ${sourceBasePackage}.mapper.${entityPackage}.${className}Mapper;
import ${sourceBasePackage}.entity.${entityPackage}.${className};
<#else>
package ${sourceBasePackage}.service.impl;
import ${sourceBasePackage}.service.${className}Service;
import ${sourceBasePackage}.mapper.${className}Mapper;
import ${sourceBasePackage}.entity.${className};
</#if>

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.com.carenet.common.web.entity.Page;
import cn.com.carenet.common.web.entity.util.PageData;

/**
 * 
 * ${description}service实现类
 * 
 * <pre>
 * 	历史记录：
 * 	${createDate} ${author}
 * 	新建文件
 * </pre>
 * 
 * @author 
 * <pre>
 * SD
 * 	${author}
 * PG
 *	${author}
 * UT
 *
 * MA
 * </pre>
 * @version $Rev$
 *
 * <p/> $Id$
 *
 */
@Service("${className?uncap_first}Service")
public class ${className}ServiceImpl implements ${className}Service {

	@Resource
	private ${className}Mapper ${className?uncap_first}Mapper;
	
	@Override
	public List<${className}> findByPage(Page page) {
		return ${className?uncap_first}Mapper.findListPage(page);
	}
	
	@Override
	public List<${className}> findBySearch(${className} ${className?uncap_first}) {
		return ${className?uncap_first}Mapper.find(${className?uncap_first});
	}
	
	@Override
	public List<${className}> findBySearch(PageData pd) {
		return ${className?uncap_first}Mapper.findWithPd(pd);
	}
	
	@Override
	public ${className} getById(${pkType} ${pkField}) {
		return ${className?uncap_first}Mapper.getById(${pkField});
	}

	@Override
	public void addAll(${className} ${className?uncap_first}) {
		if(${className?uncap_first}.getCreateTime()==null){
			${className?uncap_first}.setCreateTime(new Date());
		}
		if(${className?uncap_first}.getUpdateTime()==null){
			${className?uncap_first}.setUpdateTime(new Date());
		}
		//${className?uncap_first}.set${pkField?cap_first}(ResourceUtils.getUUID());
		${className?uncap_first}Mapper.add(${className?uncap_first});
	}
	
	@Override
	public void add(${className} ${className?uncap_first}) {
		if(${className?uncap_first}.getCreateTime()==null){
			${className?uncap_first}.setCreateTime(new Date());
		}
		if(${className?uncap_first}.getUpdateTime()==null){
			${className?uncap_first}.setUpdateTime(new Date());
		}
		//${className?uncap_first}.set${pkField?cap_first}(ResourceUtils.getUUID());
		${className?uncap_first}Mapper.addNotNull(${className?uncap_first});
	}
	
	@Override
	public void add(PageData pd) {
		if(!pd.containsKey("createTime")){
			pd.put("createTime", new Date());
		}
		if(!pd.containsKey("updateTime")){
			pd.put("updateTime", new Date());
		}
		//${className?uncap_first}.set${pkField?cap_first}(ResourceUtils.getUUID());
		${className?uncap_first}Mapper.addWithPd(pd);
	}
	
	@Override
	public void update(${className} ${className?uncap_first}) {
		if(${className?uncap_first}.getUpdateTime()==null){
			${className?uncap_first}.setUpdateTime(new Date());
		}
		${className?uncap_first}Mapper.updateNotNull(${className?uncap_first});
	}
	
	@Override
	public void update(PageData pd) {
		if(!pd.containsKey("updateTime")){
			pd.put("updateTime", new Date());
		}
		${className?uncap_first}Mapper.updateWithPd(pd);
	}

	@Override
	public void delete(${pkType} ${pkField}) {
		${className?uncap_first}Mapper.delete(${pkField});
	}
 	
 	@Override
	public void batchDelete(List<${pkType}> ${pkField}s) {
		${className?uncap_first}Mapper.batchDelete(${pkField}s);
	}
}